package com.sany.taskmanager.ui.widget;

import android.content.Context;

import androidx.annotation.NonNull;

import com.sany.taskmanager.R;
import com.sany.taskmanager.databinding.DialogTipBinding;

/**
 * 再次确认的提示框
 */
public class TipDialog extends CommonDialog<DialogTipBinding> {

    private final String mContent;
    private OnConfirmListener mOnConfirmListener;

    public void setOnConfirmListener(OnConfirmListener onConfirmListener) {
        mOnConfirmListener = onConfirmListener;
    }

    public TipDialog(@NonNull Context context, String content) {
        super(context, context.getString(R.string.tip_title));
        mContent = content;
    }

    @Override
    protected void initData() {
        vBinding.tvContent.setText(mContent);
    }

    @Override
    protected boolean confirm() {
        if (mOnConfirmListener != null) {
            mOnConfirmListener.onConfirm();
        }
        return true;
    }

    public interface OnConfirmListener {
        void onConfirm();
    }
}
